<template>
  <section>
    用户名：<input v-model="formData.name"/>
    <button @click="handleClick">登录</button>
    <sub-a></sub-a>
    <sub-b></sub-b>
  </section>
</template>

<script>

import user from "./old-state";
import subA from "./sub-a";
import subB from "./sub-b";

export default {
    components: {subA,subB},
    data() {
        return {
            formData: {
                name: ""
            },
            user
        }
    },
    methods: {
        handleClick() {
            this.user.name = this.formData.name;
        }
    }
}
</script>

<style>

</style>